home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / BFILL.C < prev    next >
Text File  |  1993-01-04  |  896b  |  40 lines

  1.  
  2. /*  File   : bfill.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 23 April 1984
  5.     Defines: bfill()
  6.  
  7.     bfill(dst, len, fill) moves "len" fill characters to "dst".
  8.     Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' ').
  9.  
  10.     Note: the "b" routines are there to exploit certain VAX order codes,
  11.     but the MOVC5 instruction will only move 65535 characters.   The asm
  12.     code is presented for your interest and amusement.
  13. */
  14.  
  15. #include "strings.h"
  16.  
  17. #if     VaxAsm
  18.  
  19. void bfill(dst, len, fill)
  20.     char *dst;
  21.     int len;
  22.     int fill;   /* actually char */
  23.     {
  24.         asm("movc5 $0,*4(ap),12(ap),8(ap),*4(ap)");
  25.     }
  26.  
  27. #else  ~VaxAsm
  28.  
  29. void bfill(dst, len, fill)
  30.     register char *dst;
  31.     register int len;
  32.     register int fill;  /* char */
  33.     {
  34.         while (--len >= 0) *dst++ = fill;
  35.  
  36.     }
  37.  
  38. #endif  VaxAsm
  39.  
  40.